#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <time.h>
#include "C06.h"

#define ARRAY_SIZE 20

int main(int argc, char* argv[])
{
    // generate 20 integers randomly
    int arrayX[ARRAY_SIZE];

    // It will get different numbers each time
    srand(time(NULL));

    // curly braces can be omitted if just one line in the loop
    for(int i=0;i<ARRAY_SIZE;i++)
        arrayX[i] = rand();
    
    // curly braces must NOT be omitted if more than one line in the loop
    printf("before sort:\n");
    for(int i=0;i<ARRAY_SIZE;i++){
        printf("%5d\x20", arrayX[i]);
        if(i % 10 == 9) printf("\n");
    }

    sort_ascent(arrayX, ARRAY_SIZE);

    printf("after sort:\n");
    for(int i=0;i<ARRAY_SIZE;i++){
        printf("%5d\x20", arrayX[i]);
        if(i % 10 == 9) printf("\n");
    }
}